﻿using System;

namespace SAFPodcast.WP8.Fwk.Helper
{
    public static class LogHelper
    {
        private const String HANDLED_ERROR = "ERROR";

        private static  event ExceptionRaisedEventHandler exceptionRaised;
        public static event ExceptionRaisedEventHandler ExceptionRaised
        {
            add
            {
                exceptionRaised += value;
            }
            remove
            {
                exceptionRaised -= value;
            }
        }

        public static void Error(String message, Exception exception)
        {
            System.Diagnostics.Debug.WriteLine(HANDLED_ERROR);
            System.Diagnostics.Debug.WriteLine(message);
            System.Diagnostics.Debug.WriteLine(exception);

            if (exceptionRaised != null)
            {
                exceptionRaised(null, new ExceptionRaisedEventArgs(message, exception));
            }
        }

        public static void Debug(String message)
        {
            System.Diagnostics.Debug.WriteLine(message);
        }

        public static void Debug(object message)
        {
            System.Diagnostics.Debug.WriteLine(message);
        }
    }
}
